package weaver.interfaces.jjy.duss.cscg;

import com.sap.mw.jco.JCO;
import weaver.interfaces.jjy.duss.util.SAPConnPool;

import java.util.HashMap;
import java.util.Map;

/**
 * @Title: ecology-9-demo
 * @Company: 泛微软件
 * @author: weaver.Dusongsong
 * @version: 1.0
 * @CreateDate: 2020-01-14
 * @Description: 总部下发门店绩效包
 * @ModifyLog:
 **/

public class Z_IF_OPS130 {
    public Map execute(Map<String, String> map) {

        SAPConnPool SAPConn = new SAPConnPool();
        JCO.Client myConnection = SAPConn.getConnection();
        JCO.Function bapi = SAPConn.excuteBapi("Z_IF_OPS130");

       // JCO.ParameterList input = bapi.getImportParameterList();//输入参数和结构处理
        JCO.ParameterList inputtable = bapi.getTableParameterList();//输入表的处理

        JCO.Table t1 = inputtable.getTable("IT_ITAB");
        t1.appendRow();
        t1.setValue(map.get("SJDQNO"), "SJDQNO");       //实际档期编号
        t1.setValue(map.get("REL_FLAG"), "REL_FLAG");   //审批标记
        t1.setValue(map.get("REL_USER"), "REL_USER");   //审批人员
        t1.setValue(map.get("REL_DATUM"), "REL_DATUM"); //审批日期
        t1.setValue(map.get("REL_UZEIT"), "REL_UZEIT"); //审批时间

        //执行函数
        myConnection.execute(bapi);
        JCO.ParameterList out = bapi.getExportParameterList();//输出参数和结构处理
       // JCO.ParameterList Table00 = bapi.getTableParameterList();//输出表的处理

        //返回处理结果以及日志
        JCO.Structure stu1 = out.getStructure("ES_MSG");
        Map<String, String> mapreturn = new HashMap<>();
        String flag = (String) stu1.getValue("TYPE");
        String message = (String) stu1.getValue("MESSAGE");
        mapreturn.put("flag", flag);
        mapreturn.put("message", message);
        System.out.println("返回结果：" + mapreturn);
        return mapreturn;
    }

}
